package service

import (
	"github.com/golang/protobuf/proto"
	. "leaf/core/error"
	"leaf/core/log"
	"leaf/core/service"
	"leaf/pb"
)

type Room struct {
	status int32
	gamers map[int32]pb.DbUser
}

type RoomService struct {
	*service.Service
	roomId int32
	rooms  map[int32]*Room
}

func NewRoomService(name string) *RoomService {
	s := &RoomService{
		Service: service.NewService(1),
	}
	return s
}

func (this *RoomService) RPC_Login(req *pb.G2L_Login) (*pb.L2G_Login, error) {
	log.Release("RPC_Login run")
	if req.GetName() == "zm" && req.GetPwd() == "123" {
		resp := &pb.L2G_Login{
			Session: proto.String("sfdwefs"),
		}
		return resp, nil
	}
	return nil, Error_Unknown
}
